package org.example.myleet.p581;

import org.example.myleet.Utils.Assert;

public class Main {
    public static void main(String[] args) {
        Solution solution = new Solution();
        Assert.isTrue(0 == solution.findUnsortedSubarray(new int[]{1}));
        Assert.isTrue(0 == solution.findUnsortedSubarray(new int[]{1,2,3,4}));
        Assert.isTrue(2 == solution.findUnsortedSubarray(new int[]{1,3,2,4,5}));
        Assert.isTrue(3 == solution.findUnsortedSubarray(new int[]{1,2,4,5,3}));
        Assert.isTrue(4 == solution.findUnsortedSubarray(new int[]{1,3,5,4,2}));
        Assert.isTrue(4 == solution.findUnsortedSubarray(new int[]{1,5,3,2,4}));
        Assert.isTrue(5 == solution.findUnsortedSubarray(new int[]{2,3,5,4,1}));
        Assert.isTrue(2 == solution.findUnsortedSubarray(new int[]{1,2,3,4,5,6,8,7}));
        Assert.isTrue(5 == solution.findUnsortedSubarray(new int[]{2,6,4,8,10,9,15}));
        Assert.isTrue(6 == solution.findUnsortedSubarray(new int[]{1,2,1,6,4,5,5}));
        Assert.isTrue(7 == solution.findUnsortedSubarray(new int[]{1,3,3,2,6,4,5,5}));
        Assert.isTrue(7 == solution.findUnsortedSubarray(new int[]{2,3,3,2,6,4,5,5}));
        Assert.isTrue(6 == solution.findUnsortedSubarray(new int[]{2,3,3,2,6,4,5,6}));
        Assert.isTrue(8 == solution.findUnsortedSubarray(new int[]{3,3,3,2,6,4,5,5}));
    }
}
